import axios from 'axios';

axios.defaults.withCredentials = true;


axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8';
axios.defaults.headers.post['Accept'] = 'application/json';

// create an axios instance
const apiService = axios.create({
    baseURL: '/' // api的base_url
    // timeout: 5000, // request timeout
});

axios.interceptors.request.use(
    config => {
        return config;
    },
    err => {
        return Promise.reject(err);
    });

axios.interceptors.response.use(
    response => {
        return response;
    },
    err => {
        return Promise.reject(err);
    });

// apiService.interceptors.response.use(res=>onRespons(res), error => onError(error));
export default apiService;
